#pragma once
#include <base_definition.h>

typedef struct packed
{
    char VESASignature[4]; // 4 signature bytes
    u16 VESAVersion;       // VESA version number
    u32 OemStringPtr;      // Pointer to OEM string
    u8 Capabilities[4];    // capabilities of the video environment
    u32 VideoModePtr;      // pointer to supported Super VGA modes
    u16 TotalMemory;       // Number of 64kb memory blocks on board
    u8 Reserved[492];      // Remainder of VgaInfoBlock
} VgaInfoBlock;

typedef struct packed
{
    u16 ModeAttributes;   // mode attributes
    u8 WinAAttributes;    // window A attributes
    u8 WinBAttributes;    // window B attributes
    u16 WinGranularity;   // window granularity
    u16 WinSize;          // window size
    u16 WinASegment;      // window A start segment
    u16 WinBSegment;      // window B start segment
    u32 WinFuncPtr;       // pointer to windor function
    u16 BytesPerScanLine; // bytes per scan line

    u16 XResolution;       // horizontal resolution
    u16 YResolution;       // vertical resolution
    u8 XCharSize;          // character cell width
    u8 YCharSize;          // character cell height
    u8 NumberOfPlanes;     // number of memory planes
    u8 BitsPerPixel;       // bits per pixel
    u8 NumberOfBanks;      // number of banks
    u8 MemoryModel;        // memory model type
    u8 BankSize;           // bank size in kb
    u8 NumberOfImagePages; // number of images
    u8 Reserved1;          // reserved for page function

    u8 RedMaskSize;         // size of direct color red mask in bits
    u8 RedFieldPosition;    // bit position of LSB of red mask
    u8 GreenMaskSize;       // size of direct color green mask in bits
    u8 GreenFieldPosition;  // bit position of LSB of green mask
    u8 BlueMaskSize;        // size of direct color blue mask in bits
    u8 BlueFieldPosition;   // bit position of LSB of blue mask
    u8 RsvdMaskSize;        // size of direct color reserved mask in bits
    u8 RsvdFieldPosition;   // bit position of LSB of reserved mask
    u8 DirectColorModeInfo; // Direct Color mode attributes

    u32 PhysBasePtr; // physical address for flat memory frame buffer
    u32 Reserved2;   // Reserved - always set to 0
    u16 Reserved3;   // Reserved - always set to 0

    u16 LinBytesPerScanLine;    // bytes per scan line for linear modes
    u8 BnkNumberOfImagePages;   // number of images for banked modes
    u8 LinNumberOfImagePages;   // number of images for linear modes
    u8 LinRedMaskSize;          // size of direct color red mask (linear modes)
    u8 LinRedFieldPosition;     // bit position of lsb of red mask (linear modes)
    u8 LinGreenMaskSize;        // size of direct color green mask (linear modes)
    u8 LinGreenFieldPositiondb; // bit position of lsb of green mask (linear modes)
    u8 LinBlueMaskSize;         // size of direct color blue mask (linear modes)
    u8 LinBlueFieldPosition;    // bit position of lsb of blue mask (linear modes)
    u8 LinRsvdMaskSize;         // size of direct color reserved mask (linear modes)
    u8 LinRsvdFieldPosition;    // bit position of lsb of reserved mask (linear modes)
    u32 MaxPixelClock;          // maximum pixel clock (in Hz) for graphics mode

    u8 Reserved4[190]; // remainder of ModeInfoBlock
} ModeInfoBlock;
